package com.innovation.wjrpc.example;


import com.innovation.wjrpc.communication.HTTPTransportServer;
import com.innovation.wjrpc.communication.NettyTransportServer;
import com.innovation.wjrpc.server.RpcServer;
import com.innovation.wjrpc.server.RpcServerConfig;

/**
 * @author innoyiya
 * @date 2021/3/6 16:46
 */
public class Server {

    public static void main(String[] args) {
        netty();
//        http();
    }

    public static void http() {
        RpcServerConfig rpcServerConfig = new RpcServerConfig();
        rpcServerConfig.setTransportClass(HTTPTransportServer.class);
        RpcServer server = new RpcServer(rpcServerConfig);
        server.register(CalcService.class, new CalcServiceImpl());
        server.start();
    }

    public static void netty() {
        RpcServerConfig rpcServerConfig = new RpcServerConfig();
        rpcServerConfig.setTransportClass(NettyTransportServer.class);
        RpcServer server = new RpcServer(rpcServerConfig);
        server.register(CalcService.class, new CalcServiceImpl());
        server.start();
    }

}
